package gold.digger;

import gold.vo.ListNode;

/**
 * Created by fanzhenyu02 on 2020/3/1.
 */
public class LC83 {

    public ListNode deleteDuplicates(ListNode head) {
        if (null == head) {
            return head;
        }

        ListNode slow = head, fast = head;
        while (fast != null) {
            if (fast.val != slow.val) {
                slow = slow.next;
                slow.val = fast.val;
            }

            fast = fast.next;
        }

        slow.next = null;
        return head;
    }


    public static void main(String[] args) {
        LC83 an = new LC83();
        ListNode st = ListNode.createList("1->1->2->2->2->2->3->3");
        System.out.println(an.deleteDuplicates(null));
    }
}
